package com.atguigu.gmall.search.dao;

import com.atguigu.gmall.search.bean.Person;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.data.repository.CrudRepository;

import javax.crypto.spec.OAEPParameterSpec;
import java.util.List;
import java.util.Optional;

//ElasticsearchRepository 专门针对es
public interface PersonEsDao extends ElasticsearchRepository<Person,Long> { //long是主键类型

    //SpringData 年龄之间,还需要起好名
    List<Person> findAllByAgeBetween(Integer age1,Integer age2);

    //18到20之间 或者名字叫zhangsan的
    List<Person> findAllByAgeBetweenOrNameEquals(Integer age1, Integer age2, String name);

    List<Person> findAllByAddressLike(String address);

    List<Person> findAllByAddressLikeAndAgeBetweenAndIdGreaterThanEqual(String address,Integer age1,Integer age2);

    List<Person> deleteAllByAddressIsLike(String address);

    //Optional<Person> dange(String address);

 }
